[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+--------------+###########################################################
#+-| WILD_EQUAL() |------------------------------------------+################
#| +--------------+ Accomplishes a "wildcard" search of mask |################
#+-----------------------------------------------------------+################
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#| #INCLUDE string.hdr |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |--------------------------------------------+###################
#| FUNCTION LOGICAL wild_equal PROTOTYPE |###################
#| PARAMETERS CONST CHAR mask, CONST CHAR string |###################
#+--------------------------------------------------------+###################
##############################################################################
##############################################################################
######+---| Description |---------------------------------------------+#######
######| This function accomplishes a "wildcard" search of mask within |#######
######| string using the * and ? characters. It is similar to a DOS |#######
######| directory search. |#######
######| ------------------------------------------------------------- |#######
######| ? indicates any character may occupy the specified position |#######
######| while * indicates any character may occupy the current and |#######
######| remaining positions within string. |#######
######| ------------------------------------------------------------- |#######
######| For example, if mask is |#######
######| |#######
######| ??ABC* |#######
######| |#######
######| then the following strings are located by wild_equal(): |#######
######| |#######
######| ddABC |#######
######| AaABCdef |#######
######| ABC |#######
######| 12ABC |#######
######+---------------------------------------------------------------+#######
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Print out all names that begin with "Da" |#########
#########| |#########
#########| LIST ALL FOR wild_equal( "Da*", a->names ) |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Use wild_equal() to perform an "incremental search" |#########
#########| * This is a search wherein, as an operator types, |#########
#########| * the database narrows to the final name. |#########
#########| |#########
#########| sc = "" |#########
#########| |#########
#########| REPEAT |#########
#########| k = get_key() |#########
#########| If k = &K_ENTER |#########
#########| RETURN |#########
#########| ENDIF |#########
#########| |#########
#########| *--- 1st... get rid of last * char |#########
#########| sc = substr( sc,1,len( sc ) - 1 ) |#########
#########| |#########
#########| sc = sc + chr( k ) + "*" |#########
#########| SEEK wild_equal( sc, dbf->first ) |#########
#########| |#########
#########| UNTIL .NOT. found() |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
at()
found()
rat()
substr()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson